package top.frsf.starter.impl;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import top.frsf.constants.ImageConstant;
import top.frsf.enums.GameStateEnum;
import top.frsf.object.zombie.NormalZom;
import top.frsf.object.zombie.ZomObject;
import top.frsf.panel.GamePanel;
import top.frsf.schedule.ZomTmeTask;
import top.frsf.starter.Starter;

import java.awt.*;
import java.util.ArrayList;
import java.util.Random;

/**
 * @author FRSF
 * @since 2025/8/3 13:29
 */
@Slf4j
@Data
public class ZomStarter implements Starter {
    /**
     * zom列表
     */
    private final ArrayList<ZomObject> zomList = new ArrayList<>();
    /**
     * 死亡zom列表
     */
    private final ArrayList<ZomObject> deadZomList = new ArrayList<>();

    @Override
    public void init() {
        log.info("zom启动器初始化");
        ZomTmeTask.start();
    }

    @Override
    public void start(Graphics g) {
        if (GamePanel.state == GameStateEnum.RUNNING) {
            zomList.forEach(zom -> zom.paintSelfImage(g));
            zomList.removeAll(deadZomList);
            deadZomList.clear();
        }
    }
}
